package org.example.demo.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @ClassName: Fsk App
 * @Copyright: com.fsk
 * @Version: 1.0.0
 * @Author: chenming2
 * @UpdateTime: 2/28/2022
 * @Describe: XXXXXXX.
 */
@Repository
public class UserDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void plus(Double money, String name) {
        String sql = "update user set money = money - ? where id = ?";
        jdbcTemplate.update(sql, money, name);
    }

    public void minus(Double money, String name) {
        String sql = "update user set money = money - ? where id = ?";
        jdbcTemplate.update(sql, money, name);
    }
}
